package org.shiki.hrm.controller;

import org.shiki.hrm.dto.LoginDto;
import org.shiki.hrm.dto.RTokenDto;
import org.shiki.hrm.service.ILoginUserService;
import org.shiki.hrm.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/hrm")
public class LoginController {

	@Autowired
	private ILoginUserService loginUserService;

	@PostMapping("/login")
	public AjaxResult login(@RequestBody @Valid LoginDto loginDto){
		return loginUserService.login(loginDto);
	}

	@PostMapping("/rtoken")
	public AjaxResult rtoken(@RequestBody @Valid RTokenDto rTokenDto){
		return loginUserService.rtoken(rTokenDto);
	}
}
